package com.xkcun.crm.api;


import com.aliyuncs.cloudauth.model.v20190307.DescribeFaceVerifyResponse;
import com.aliyuncs.cloudauth.model.v20190307.InitFaceVerifyResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xkcun.crm.entity.Agree;
import com.xkcun.crm.param.AgreeListParam;
import com.xkcun.crm.param.FaceVerifyInitParam;
import com.xkcun.crm.service.AgreeService;
import com.xkcun.third.aliyun.faceVerify.FaceVerifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 测试人脸识别
 * @author yfz
 * @since 2021-08-06 13:49:32
 */
@Api(value = "人脸识别demo", description = "人脸识别demo")
@RestController
@RequestMapping("test")
public class FaceDemoApi extends ApiController {



    /**
     * 服务对象
     */
    @Resource
    private FaceVerifyService faceVerifyService;


    @ApiOperation(value = "人脸识别初始化", notes = "人脸识别初始化")
    @PostMapping("/init")
    public R init(@RequestBody FaceVerifyInitParam param) throws Exception{
        InitFaceVerifyResponse.ResultObject resultObject =
                faceVerifyService.initFaceVerify(1000001906L,param.getName(),param.getIdNo(),param.getReturnUrl(),param.getMetaInfo());
        return success(resultObject);
    }

    @ApiOperation(value = "人脸识别结果查询", notes = "人脸识别结果查询")
    @PostMapping("/query")
    public R query(@RequestBody String certifyId) throws Exception {
        DescribeFaceVerifyResponse.ResultObject resultObject;
        resultObject = faceVerifyService.describeFaceVerify(1000001906L, certifyId);
        return success(resultObject);
    }

}